$(document).ready(function () {
    jbxx.onload();
});
var jbxx = (function () {
    return {
        onload:function () {
           	jbxx.tabChange();
           	jbxx.tableData();
        },
		/*tab切换*/
		tabChange:function(){
			$('.wep_jbxx_tab li').on('click',function(){
				$('.wep_jbxx_tab li').removeClass('active');
				$(this).addClass('active');
				$('.wep_jbxx_div').hide();
				$('.wep_jbxx_div').eq($(this).index()).show();
			})
		},
		/*表格数据交互*/
	    tableData: function() {
	 		var data = [{
	 				"ry": "法定代表人",
	 				"name": "宋亚亚",
	 				"cardtype": "居民身份证",
	 				"id":"4107234534567535",
	 				"phonenumber": "13756452346",
	 				"state": "已认证"
	 			},
	 			{
	 				"ry": "财务负责人",
	 				"name": "宋亚亚",
	 				"cardtype": "居民身份证",
	 				"id":"4107234534567535",
	 				"phonenumber": "13756452346",
	 				"state": "未认证"
	 			},
	 			{
	 				"ry": "办税人",
	 				"name": "宋亚亚",
	 				"cardtype": "居民身份证",
	 				"id":"4107234534567535",
	 				"phonenumber": "13756452346",
	 				"state": "已认证"
	 			}
	 		];
	 		$('#wep_bgxx_table').DataTable({
	 			"data": data,
	 			"columns": [
	 			    {
	 					"data": "ry"
	 				},
	 			    {
	 					"data": "name"
	 				},
	 				{
	 					"data": "cardtype"
	 				},
	 				{
	 					"data": "id"
	 				},
	 				{
	 					"data": "phonenumber"
	 				},
	 				{
	 					"data": "state"
	 				}
	 			],
	 			"paging": false,
	 			"ordering": false,
	 			"info": false,
	 			"lengthChange": false,
	 			"searching": false,
	 			"fnInitComplete": function (oSettings, json) {/*判断认证状态显示字体颜色*/
		            for(var i=0;i<$('#wep_bgxx_table tbody tr').length;i++){
		            	if($('#wep_bgxx_table tbody tr').eq(i).find('td').eq(5).text() == "已认证"){
		            		$('#wep_bgxx_table tbody tr').eq(i).find('td').eq(5).addClass('ycl')
		            	}else{
		            		$('#wep_bgxx_table tbody tr').eq(i).find('td').eq(5).addClass('wcl')
		            	}
		            }
		        }
	 		});
	 	},
	}
})();